{
  "properties" : { },
  "id" : "75114412fd084cccbcf3f1aa766d0ecd",
  "script" : null,
  "groupId" : "0ae13df90a5c41a7930f46ab7d7936cb",
  "name" : "查询模型树",
  "createTime" : 1727070890548,
  "updateTime" : 1726122968934,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "tree",
  "method" : "GET",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": [\n        {\n            \"id\": \"1656467586137817090\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"设备基础信息\",\n            \"children\": [],\n            \"type\": \"标量模型\"\n        },\n        {\n            \"id\": \"1656476788692398082\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"设备接口信息\",\n            \"children\": [],\n            \"type\": \"表格模型\"\n        },\n        {\n            \"id\": \"1656487624819433474\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"管理信息\",\n            \"children\": [\n                {\n                    \"id\": \"1656487887840043009\",\n                    \"parentId\": \"1656487624819433474\",\n                    \"weight\": 0,\n                    \"name\": \"SNMP信息\",\n                    \"children\": [],\n                    \"type\": \"标量模型\"\n                },\n                {\n                    \"id\": \"1656611540023967745\",\n                    \"parentId\": \"1656487624819433474\",\n                    \"weight\": 0,\n                    \"name\": \"ssh协议信息\",\n                    \"children\": [],\n                    \"type\": \"标量模型\"\n                },\n                {\n                    \"id\": \"1656631110206029826\",\n                    \"parentId\": \"1656487624819433474\",\n                    \"weight\": 0,\n                    \"name\": \"归属信息\",\n                    \"children\": [],\n                    \"type\": \"标量模型\"\n                },\n                {\n                    \"id\": \"1656632311307894785\",\n                    \"parentId\": \"1656487624819433474\",\n                    \"weight\": 0,\n                    \"name\": \"其他信息\",\n                    \"children\": [],\n                    \"type\": \"标量模型\"\n                }\n            ],\n            \"type\": \"标量模型\"\n        },\n        {\n            \"id\": \"1656498101330997250\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"新增测试1测试用勿删\",\n            \"children\": [\n                {\n                    \"id\": \"1656534620905238530\",\n                    \"parentId\": \"1656498101330997250\",\n                    \"weight\": 0,\n                    \"name\": \"测试1子1dd\",\n                    \"children\": [],\n                    \"type\": \"标量模型\"\n                }\n            ],\n            \"type\": \"标量模型\"\n        },\n        {\n            \"id\": \"1656549388437217282\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"运行负载\",\n            \"children\": [],\n            \"type\": \"表格模型\"\n        },\n        {\n            \"id\": \"1656580524127330305\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"CPU利用率\",\n            \"children\": [],\n            \"type\": \"折线模型\"\n        },\n        {\n            \"id\": \"1656580857297674241\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"内存利用率\",\n            \"children\": [],\n            \"type\": \"折线模型\"\n        },\n        {\n            \"id\": \"1656585622656188417\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"ARP表\",\n            \"children\": [],\n            \"type\": \"表格模型\"\n        },\n        {\n            \"id\": \"1657941089332563969\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"路由表\",\n            \"children\": [],\n            \"type\": \"表格模型\"\n        },\n        {\n            \"id\": \"1658464767430463490\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"链路信息\",\n            \"children\": [],\n            \"type\": \"表格模型\"\n        },\n        {\n            \"id\": \"1659018818740072450\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"地址转发表\",\n            \"children\": [],\n            \"type\": \"表格模型\"\n        },\n        {\n            \"id\": \"1735550202917445634\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"ceshi345\",\n            \"children\": [],\n            \"type\": \"标量模型\"\n        },\n        {\n            \"id\": \"1817742331004112897\",\n            \"parentId\": \"0\",\n            \"weight\": 0,\n            \"name\": \"实体信息\",\n            \"children\": [],\n            \"type\": \"表格模型\"\n        }\n    ]\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }
}
================================
import java.math.BigDecimal
import cn.hutool.core.lang.tree.TreeUtil
import cn.hutool.core.util.ObjectUtil
import cn.hutool.core.lang.tree.TreeNode
list = db.select(" select * from ndmp_dynamic_model ")
nodeList = new ArrayList()
list.each(r -> {
    if (ObjectUtil.isEmpty(r.parentId)) {
        r.parentId = new BigDecimal(0);
    }
    treeNode = new TreeNode(r.id, r.parentId, r.name, 0)
    extra = new HashMap()
    extra.put("type", r.type)
    // extra.put("attributeList",[])
    extra.put("children", [])
    treeNode.setExtra(extra)
    nodeList.add(treeNode);
})
treeList = TreeUtil.build(nodeList, new BigDecimal(0))
return treeList